<?php

//SANITIZE ALL ESCAPES
$sanitize_all_escapes = true;
//
//STOP FAKE REGISTER GLOBALS
$fake_register_globals = false;
//

$ignoreAuth = true;

require_once('../interface/globals.php');
include_once("$srcdir/patient.inc");
include_once("history.inc.php");
include_once("$srcdir/acl.inc");
include_once("$srcdir/options.inc.php");

$pid = $_SESSION['pid'];
$tmp = getPatientData($pid, "squad");


foreach ($_POST as $key => $val) {
    if ($val == "YYYY-MM-DD") {
        $_POST[$key] = "";
    }
}

// Update history_data:
//
$newdata = array();
$fres = sqlStatement("SELECT * FROM layout_options " .
        "WHERE form_id = 'HIS' AND uor > 0 AND field_id != '' " .
        "ORDER BY group_name, seq");
while ($frow = sqlFetchArray($fres)) {
    $field_id = $frow['field_id'];
    $newdata[$field_id] = get_layout_form_value($frow);
}
updateHistoryData($pid, $newdata);

if (isset($_REQUEST['medico'])) {
    $_SESSION['medico'] = '1';
}
$mensajeGuardar = true;
include_once("history_full.php");
//
//if ($GLOBALS['concurrent_layout']) {
//    include_once("history_full.php");
//} else {
//    include_once("history_full.php");
//}
?>
